package com.example.zhihuigongdi.controller;


import com.example.zhihuigongdi.entity.Cameras;
import com.example.zhihuigongdi.entity.Machinery;
import com.example.zhihuigongdi.entity.respon.Result;
import com.example.zhihuigongdi.service.ICamerasService;
import com.example.zhihuigongdi.service.IMachineryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author liuhongbin
 * @since 2024-04-17
 */
@RestController
@RequestMapping("/cameras")
public class CamerasController {

    @Autowired
    private ICamerasService camerasService;

    @PostMapping("/list/{current}/{size}")
    public Result list(@PathVariable int current, @PathVariable int size){
        return camerasService.getCameras(current,size);
    }

    @PostMapping("/add")
    public Result add(@RequestBody Cameras cameras){
        return camerasService.addCamera(cameras);
    }

    @PostMapping("/add/{camera_id}")
    public Result remove(@PathVariable int camera_id ){
        return camerasService.removeCamera(camera_id);
    }
}
